Adapt camera-proxy to new pyro-camera-api client#569
Conversation
Rename pos_id to patrol_id on /capture, add duration/zoom to legacy /control/move, and expose focused PTZ endpoints (goto_preset, start_move, stop_move, move_for_duration, move_by_degrees, click_to_move) plus /control/speed_tables.
Aligns with the client change where omitting speed lets the server auto-pick the best calibrated level for the target angle.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #569 +/- ##
==========================================
+ Coverage 89.92% 90.11% +0.18%
==========================================
Files 55 55
Lines 2451 2498 +47
==========================================
+ Hits 2204 2251 +47
Misses 247 247
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
fe51
left a comment
There was a problem hiding this comment.
Hi @MateoLostanlen , I have made small modificaiton as suggestion
- Introduced CameraDirection = Literal["Left", "Right", "Up", "Down"] type alias; applied it to start_move, move_for_duration, and move_by_degrees — invalid directions now return 422 instead of failing downstream
- Added deprecated=True to the /control/move route decorator so it appears struck-through in the OpenAPI docs
Also, I have one question about /control/stop and /control/stop_move
Do these call different downstream methods that have genuinely different scopes? If yes, the summaries should reflect that:
- stop_move → "Halt the current continuous PTZ move" ?
- stop_camera → "Stop all camera activity" (or whatever it actually does) ?
If they turn out to do the same thing, one of them should be removed or at least stop should be deprecated like move.
| summary="Move toward a normalized image click", | ||
| ) | ||
| async def proxy_click_to_move( | ||
| click_x: float = Query(..., ge=0.0, le=1.0, description="Normalized x coordinate in [0, 1]"), |
There was a problem hiding this comment.
Would not be more robust to put x y. in the payload/body instead of a param url ?
Upstream pyro_camera_api implements stop_move as `return stop_camera(camera_ip)`, so /control/stop and /control/stop_move call the same downstream operation. Pair the /control/stop deprecation with the existing /control/move deprecation, and tighten the stop_move summary for OpenAPI clarity.
The five new POSTs introduced in this PR (goto_preset, start_move, move_for_duration, move_by_degrees, click_to_move) now accept their operands as a JSON body instead of query parameters. Defines small Pydantic request models with the same validation constraints (gt=0, ge=0.0, le=1.0). Tests parametrize updated to send JSON bodies. POST state-changing commands belong in the body, not the URL — and since these endpoints are net-new and unreleased, the change is free.
Switch the pyro-camera-api-client git source from the develop branch to main, and regenerate poetry.lock so the resolved reference picks up commit 6d525b1 which carries the new focused PTZ client methods (goto_preset, start_move, stop_move, move_for_duration, move_by_degrees, click_to_move, get_speed_tables). Unblocks pytest CI.
The latest types-requests release narrowed the expected types for `headers` (now MutableMapping[str, str | bytes]) and `json` (now the invariant JsonType). Widen the `headers` property return type and annotate the heterogeneous occlusion-mask payload accordingly. Restores green mypy-client CI (red on main since dca6654).
# Conflicts: # client/pyroclient/client.py
|
Hi @fe51, fair point. Keeping /control/stop_move for symmetry with start_move, and deprecating the legacy /control/move + /control/stop together. They'll be removed in a later cleanup pass on pyro-engine + the API once the focused routes are fully adopted. |
fe51
left a comment
There was a problem hiding this comment.
Hi @MateoLostanlen thank you for the update ! Lets merge !
Summary
After upted in pyro-camera-api client
to the legacy /control/move.
click_to_move, plus GET /control/speed_tables.